<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    //删除第一个元素
    // let arr = [1, 2, 3, 4, 5, 6, 7, 8];
    // console.log('调用shift之前：' + arr);
    // let shitfed = arr.shift();
    // console.log('调用shift之后：' + arr);
    // console.log('被删除的元素：' + shitfed);

    //删除最后的元素
    // let arr = [1, 2, 3, 4, 5];
    // let popped = arr.pop();
    // console.log('删除后的数组' + arr);
    // console.log('删除的元素' + popped);

    let arr = [1, 2, 3, 4, 5, 6];
    arr.unshift(0);
    console.log(arr);
    let arr1 = [1, 2, 3, 4, 5, 6];
    arr1.pop();
    arr1.pop();
    console.log(arr1);
    let arr2 = [1, 2, 3, 4, 5, 6];
    arr2.push(7, 8);
    console.log(arr2);
    let arr3 = [1, 2, 3, 4, 5, 6];
    arr3.shift();
    arr3.shift();
    console.log(arr3);
    let arr4 = [1, 2, 3, 4, 5, 6];
    arr4.shift();
    arr4.shift();
    arr4.push(7, 9);
    console.log(arr4);
</script>

<body>

</body>

</html>